Fix Page_Up and Page_Down in the completion popup to move page-wise if
authorMatthias Clasen <maclas@gmx.de>
Sun, 29 Feb 2004 02:30:37 +0000 (02:30 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 29 Feb 2004 02:30:37 +0000 (02:30 +0000)
Sun Feb 29 03:31:42 2004  Matthias Clasen  <maclas@gmx.de>

* gtk/gtkentry.c (gtk_entry_completion_key_press): Fix Page_Up
and Page_Down in the completion popup to move page-wise if we're
scrolling.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkentry.c

index a103a39f9b2d26e647bc921cc1a2139d441f7bdd..a2acbe03424de4f96f010104c1d69464df9a10b6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sun Feb 29 03:31:42 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentry.c (gtk_entry_completion_key_press): Fix Page_Up 
+       and Page_Down in the completion popup to move page-wise if we're
+       scrolling.
+
 2004-02-28  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (set_cell_text_bold_if_folder):
index a103a39f9b2d26e647bc921cc1a2139d441f7bdd..a2acbe03424de4f96f010104c1d69464df9a10b6 100644 (file)
@@ -1,3 +1,9 @@
+Sun Feb 29 03:31:42 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentry.c (gtk_entry_completion_key_press): Fix Page_Up 
+       and Page_Down in the completion popup to move page-wise if we're
+       scrolling.
+
 2004-02-28  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (set_cell_text_bold_if_folder):
index a103a39f9b2d26e647bc921cc1a2139d441f7bdd..a2acbe03424de4f96f010104c1d69464df9a10b6 100644 (file)
@@ -1,3 +1,9 @@
+Sun Feb 29 03:31:42 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentry.c (gtk_entry_completion_key_press): Fix Page_Up 
+       and Page_Down in the completion popup to move page-wise if we're
+       scrolling.
+
 2004-02-28  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (set_cell_text_bold_if_folder):
index a103a39f9b2d26e647bc921cc1a2139d441f7bdd..a2acbe03424de4f96f010104c1d69464df9a10b6 100644 (file)
@@ -1,3 +1,9 @@
+Sun Feb 29 03:31:42 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentry.c (gtk_entry_completion_key_press): Fix Page_Up 
+       and Page_Down in the completion popup to move page-wise if we're
+       scrolling.
+
 2004-02-28  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (set_cell_text_bold_if_folder):
index a103a39f9b2d26e647bc921cc1a2139d441f7bdd..a2acbe03424de4f96f010104c1d69464df9a10b6 100644 (file)
@@ -1,3 +1,9 @@
+Sun Feb 29 03:31:42 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentry.c (gtk_entry_completion_key_press): Fix Page_Up 
+       and Page_Down in the completion popup to move page-wise if we're
+       scrolling.
+
 2004-02-28  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (set_cell_text_bold_if_folder):
index 981830f6dcfe67359634ccf7c47784a8eb810de6..ab5c2c9e4cf87f2edc95254c4bf45f66fe8646b6 100644 (file)
@@ -4560,7 +4560,7 @@ gtk_entry_completion_key_press (GtkWidget   *widget,
   if (keyval_is_cursor_move (event->keyval))
     {
       GtkTreePath *path = NULL;
-
+      
       if (event->keyval == GDK_Up || event->keyval == GDK_KP_Up)
         {
           completion->priv->current_selected--;
@@ -4574,10 +4574,39 @@ gtk_entry_completion_key_press (GtkWidget   *widget,
             completion->priv->current_selected = matches + actions - 1;
         }
       else if (event->keyval == GDK_Page_Up)
-        completion->priv->current_selected = 0;
-
+       {
+         if (completion->priv->current_selected <= 0)
+           completion->priv->current_selected = -1;
+         else if (completion->priv->current_selected < matches) 
+           {
+             completion->priv->current_selected -= 14;
+             if (completion->priv->current_selected < 0)
+               completion->priv->current_selected = 0;
+           }
+         else 
+           {
+             completion->priv->current_selected -= 14;
+             if (completion->priv->current_selected < matches - 1)
+               completion->priv->current_selected = matches - 1;
+           }
+       }
       else if (event->keyval == GDK_Page_Down)
-        completion->priv->current_selected = matches + actions - 1;
+       {
+         if (completion->priv->current_selected < 0)
+           completion->priv->current_selected = 0;
+         else if (completion->priv->current_selected < matches - 1)
+           {
+             completion->priv->current_selected += 14;
+             if (completion->priv->current_selected > matches - 1)
+               completion->priv->current_selected = matches - 1;
+           }
+         else 
+           {
+             completion->priv->current_selected += 14;
+             if (completion->priv->current_selected > matches + actions - 1)
+               completion->priv->current_selected = matches + actions - 1;
+           }
+       }
 
       if (completion->priv->current_selected < 0)
         {
@@ -4643,7 +4672,7 @@ gtk_entry_completion_key_press (GtkWidget   *widget,
               /* move the cursor to the end */
               gtk_editable_set_position (GTK_EDITABLE (widget), -1);
 
-              g_free (str);
+             g_free (str);
             }
 
           return TRUE;